﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Common;

namespace WebSite.Core
{
    public class AgeCalcHelper
    {
        public static string AgeCalc(DateTime? date)
        {
            return AgeCalc(NullableHelper.CastValueType(date));
        }

        public static string AgeCalc(DateTime date)
        {
            if (DateTime.Now  < date)
            {
                return "未满月";
            }

            var ts = DateTime.Now - date;
            int month = Convert.ToInt32(ts.TotalDays / 30);

            if (month > 48)
            {
                return "未知";
            }
            else
            {
                return month + "个月";
            }
        }
    }
}